<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.css" />
    <style>
        .wrap {
            width: 100%;
            overflow: hidden;
        }

        .wrap_inner {
            width: 100%;
            padding: 0 15px;
            overflow: hidden;
        }

        .my_order {
            width: 100%;
            background: #fff;
            margin-top: 10px;
            overflow: hidden;
            padding: 20px 15px;
            border-radius: 8px;
        }

        .my_order_inner {
            width: 100%;
            overflow: hidden;
        }

        .title {
            font-size: 15px;
            color: #222222;
            font-weight: bolder;
        }

        .my_order_inner .content {
            width: 100%;
            margin-top: 20px;
            overflow: hidden;
            display: flex;
            justify-content: space-between;
        }

        .my_order_inner .content div {
            /*width: 100%;
            flex: 1;*/
        }

        .my_order_inner .content div:active {
            background: #f5f5f5;
        }

        .my_order_inner .content div span {
            display: block;
            text-align: center;
        }

        .my_order_inner .content div span:first-child {
            width: 34px;
            height: 34px;
            margin: 0 auto;
        }

        .my_order_inner .content div span:last-child {
            font-size: 14px;
            color: #333333;
            letter-spacing: 0;
        }

        .my_release {
            width: 100%;
            background: #fff;
            margin-top: 10px;
            overflow: hidden;
            padding: 20px 15px;
            border-radius: 8px;
            margin-top:30px;
        }

        .my_release_inner {
            width: 100%;
            overflow: hidden;
        }

        .my_release_inner .content {
            width: 100%;
            display: flex;
            justify-content: space-between;
            overflow: hidden;
        }

        .my_release_inner .content div {
            /*width: 25%;
            float: left;*/
            margin-top: 24px;
        }

        .my_release_inner .content div:active {
            background: #f5f5f5;
        }

        .my_release_inner .content div span {
            display: block;
            text-align: center;
        }

        .my_release_inner .content div span:first-child {
            width: 30px;
            height: 30px;
            margin: 0 auto;
        }

        .my_release_inner .content div span:last-child {
            font-size: 14px;
            color: #333333;
            letter-spacing: 0;
        }

        .banner {
            width: 100%;
            height: 70px;
            /*margin: 10px 0;*/
        }

        .banner img {
            display: block;
            width: 100%;
            height: 100%;
        }

        [v-cloak] {
            display: none!important;
        }
    </style>
</head>

<body>
    <div class="wrap" v-cloak id="app">
        <div class="wrap_inner">
            <div class="banner">
                <div class="swiper-container swiper1">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" v-for='item in bannerUrl'>
                            <img alt="" :src="item.pic" alt="">
                        </div>
                    </div>
                    <!-- <div class="swiper-pagination"></div> -->
                </div>
                <!-- <img src="../../image/active-banner.png" alt=""> -->
            </div>
            <div class="my_release" style="margin-bottom:15px;">
                <div class="my_release_inner">
                    <div class="title">更多服务</div>
                    <div class="content">
                        <div @click='openBrowseFootprintPage()'>
                            <span><img src="../../image/qualification_icon.png" alt=""></span>
                            <span>浏览足迹</span>
                        </div>
                        <div @click='openFeedBackPage()'>
                            <span><img src="../../image/customerservice_icon.png" alt=""></span>
                            <span>意见反馈</span>
                        </div>
                        <div @click='openSeviceHelpPage()'>
                            <span><img src="../../image/service.png" alt=""></span>
                            <span>专属客服</span>
                        </div>
                        <div @click='openHelpCenterPage()'>
                            <span><img src="../../image/storeinfor_icon.png" alt=""></span>
                            <span>帮助中心</span>
                        </div>
                    </div>
                    <div class="content">

                        <div @click='openMyCollectionPage()'>
                            <span><img src="../../image/collection_icon.png" alt=""></span>
                            <span>我的收藏</span>
                        </div>
                        <div @click='openSharePage()'>
                            <span><img src="../../image/share_icon.png" alt=""></span>
                            <span>分享App</span>
                        </div>
                        <div @click='openAboutUsPage()' style="visibility: hidden;">
                            <span><img src="../../image/version_icon.png" alt=""></span>
                            <span>版本更新</span>
                        </div>
                        <div @click='openMyStoryPage()' style="visibility: hidden;">
                            <span><img src="../../image/storeinfor_icon.png" alt=""></span>
                            <span>店铺信息</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript" src="../../script/fastclick.js"></script>
<script type="text/javascript" src="../../script/swiper-bundle.min.js"></script>
<script type="text/javascript">
    apiready = function() {
        FastClick.attach(document.body); //解决vue在ios下点击延迟的问题
        // cl.apiready();
        if ($api.getStorage('userToken')) {
            vm.is_login = true;
        } else {
            vm.is_login = false;
        }
        /**
         * [name 监听登录成功]
         * @type {String}
         */
        api.addEventListener({
            name: 'login_success'
        }, function(ret, err) {
            if (ret) {
                vm.is_login = true;
            }
        });
        /**
         * [name监听退出登录]
         * @type {String}
         */
        api.addEventListener({
            name: 'logout_success'
        }, function(ret, err) {
            if (ret) {
                vm.is_login = false;
            }
        });

        vm.init()

    }

    var vm = new Vue({
        el: "#app",
        data: {
            is_login: false, //用户是否登录
            bannerUrl: []
        },
        methods: {
            init: function() {
                api.ajax({
                    url: cl.apiServer + 'banner/list/' + 2,
                    method: 'get'
                }, function(ret, err) {
                    if (ret) {
                        if (ret.code == 0) {
                            vm.bannerUrl = ret.data;
                            setTimeout(function() {
                                var swiper = new Swiper('.swiper1', {
                                    autoplay: {
                                        delay: 3000,
                                        disableOnInteraction: false,
                                        waitForTransition: true,
                                    },
                                    on: {
                                        click: function() {
                                           const realIndex = this.realIndex;
                                          //  alert(realIndex)
                                           let url = vm.bannerUrl[realIndex].url;
                                           let urlType = vm.bannerUrl[realIndex].urlType
                                           if (urlType == 0) {
                                               cl.openWin({
                                                   name: '../../brower',
                                                   pageParam: {
                                                       link: url
                                                   }
                                               })
                                           }
                                        },
                                    },
                                    freeMode: false,
                                    touchRatio: 1,
                                    observeParents: true,
                                    observer: true,
                                    loop: true,
                                });
                            }, 0)
                        }
                    }
                });
            },
            openBrowseFootprintPage:function(){
              if (vm.is_login) {
                  cl.openWin({
                      name: 'browse_footprint'
                  });
              } else {
                  cl.openWin({
                      name: '../login/code_login'
                  })
              }
            },
            //专属客服
            openSeviceHelpPage: function() {
                if (vm.is_login) {
                    cl.openWin({
                        name: 'service'
                    });
                } else {
                    cl.openWin({
                        name: '../login/code_login'
                    })
                }
            },
            openFeedBackPage: function() {
                if (vm.is_login) {
                    cl.openWin({
                        name: 'feed_back'
                    });
                } else {
                    cl.openWin({
                        name: '../login/code_login'
                    })
                }
            },
            openHelpCenterPage: function() {
                if (vm.is_login) {
                    cl.openWin({
                        name: 'help_center'
                    });
                } else {
                    cl.openWin({
                        name: '../login/code_login'
                    })
                }
            },
            openMyCollectionPage: function() {
                if (vm.is_login) {
                    cl.openWin({
                        name: 'my_collection'
                    });
                } else {
                    cl.openWin({
                        name: '../login/code_login'
                    })
                }

            },
            openAboutUsPage: function() {
                cl.openWin({
                    name: 'about_us'
                });
            },
            openSharePage: function() {
                api.openFrame({
                    name: '../main/share',
                    url: '../main/share.html',
                    bounces: false,
                    rect: {
                        marginTop: 0, // main页面距离win顶部的高度
                        // marginBottom: footerH ,
                        marginBottom: api.safeArea.bottom, // main页面距离win底部的高度
                        w: 'auto' // main页面的宽度 自适应屏幕宽度
                    },
                    bgColor: 'rgba(255,255,255,0)'
                });
            }

        }
    })
</script>

</html>
